﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DBTMDT.Dal;

namespace DBTMDT.Biz
{
    class BizAutoBid
    {
        public int IdAutoBid { get; set; }
        public string MaAutoBid { get; set; }
        public decimal GiaBatDauBid { get; set; }
        public Decimal GiaKetThucBid { get; set; }
        public int SoLuongBid { get; set; }
        public int SoLanConLai { get; set; }
        public BizUser IdUser { get; set; }
        public BizPhienDau IdPhiendau { get; set; }

        public BizAutoBid()
        {
            this.IdAutoBid = -1;
            this.IdUser = new BizUser();
            this.IdPhiendau = new BizPhienDau();
        }

        public BizAutoBid(int IdAutoBid, string MaAutoBid, decimal GiaBatDauBid, decimal GiaKetThucBid,
            int SoLanBid, int SoLanConLai, BizUser IdUser, BizPhienDau IdPhienDau
            )
        {
            this.IdAutoBid = IdAutoBid;
            this.MaAutoBid = MaAutoBid;
            this.GiaBatDauBid = GiaBatDauBid;
            this.GiaKetThucBid = GiaKetThucBid;
            this.SoLanConLai = SoLanConLai;
            this.SoLuongBid = SoLuongBid;
            this.IdUser = IdUser;
            this.IdPhiendau = IdPhiendau;
        }

        public BizAutoBid( string MaAutoBid, decimal GiaBatDauBid, decimal GiaKetThucBid,
         int SoLanBid, int SoLanConLai, BizUser IdUser, BizPhienDau IdPhienDau
         )
        {
           
            this.MaAutoBid = MaAutoBid;
            this.GiaBatDauBid = GiaBatDauBid;
            this.GiaKetThucBid = GiaKetThucBid;
            this.SoLanConLai = SoLanConLai;
            this.SoLuongBid = SoLuongBid;
            this.IdUser = IdUser;
            this.IdPhiendau = IdPhiendau;
        }



        public void Save()
        {
            if (this.IdAutoBid == -1)
                this.IdAutoBid = DalAutoBid.Insert(this);
            else
                DalAutoBid.Update(this);
        }

    }
}
